﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Runtime.InteropServices;

namespace AutoLoL.Logic.Parsers
{
    public class SknParser
    {
        public static string SknToObj(string filename)
        {
            IntPtr ptr = IntPtr.Zero;
            int len = 0;
            skn2obj(filename, ref ptr, ref len);
            return Marshal.PtrToStringAnsi(ptr);
        }

        // dumpbin /exports RiotSkn2Obj.dll
        [DllImport("RiotSkn2Obj.dll", EntryPoint = "?skn2obj@@YAHPA_WPAPADPAH@Z", CallingConvention = CallingConvention.Cdecl)]
        private static extern int skn2obj(
            [MarshalAs(UnmanagedType.LPWStr)]
            string filename,
            ref IntPtr @out,
            ref int len
        );
    }
}
